package cn.xianyang.system.service.impl;

import cn.xianyang.basic.mapper.BaseMapper;
import cn.xianyang.basic.query.BaseQuery;
import cn.xianyang.basic.service.impl.BaseServiceImpl;
import cn.xianyang.basic.util.PageList;
import cn.xianyang.system.domain.Systemdictionarydetail;
import cn.xianyang.system.mapper.SystemdictionarydetailMapper;
import cn.xianyang.system.query.SystemdictionarydetailQuery;
import cn.xianyang.system.service.ISystemdictionarydetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemdictionarydetailServiceImpl extends BaseServiceImpl<Systemdictionarydetail> implements ISystemdictionarydetailService {

    @Autowired
    private BaseMapper<Systemdictionarydetail> mapper;

    @Autowired
    private SystemdictionarydetailMapper systemdictionarydetailMapper;

    @Override
    public void save(Systemdictionarydetail systemdictionarydetail) {
        mapper.save(systemdictionarydetail);
    }

    @Override
    public void update(Systemdictionarydetail systemdictionarydetail) {
        mapper.update(systemdictionarydetail);
    }

    @Override
    public void removeById(Long id) {
        mapper.deleteById(id);
    }

    @Override
    public List<Systemdictionarydetail> queryAll() {
        return mapper.loadAll();
    }

    @Override
    public Systemdictionarydetail queryById(Long id) {
        return mapper.loadById(id);
    }

    @Override
    public PageList<Systemdictionarydetail> queryPage(BaseQuery tQuery) {
        Long total = mapper.queryCount(tQuery);
        List<Systemdictionarydetail> data = mapper.queryData(tQuery);
        return new PageList<>(total,data);
    }

    @Override
    public void batchRemove(List<Long> ids) {
        mapper.batchRemove(ids);
    }

    @Override
    public PageList<Systemdictionarydetail> loadByTypeId(SystemdictionarydetailQuery systemdictionarydetailQuery) {
        Long total = systemdictionarydetailMapper.countByTypeId(systemdictionarydetailQuery);
        List<Systemdictionarydetail> data = systemdictionarydetailMapper.loadByTypeId(systemdictionarydetailQuery);
        return new PageList<>(total,data);
    }
}